package com.zjp.service.impl;
import com.zjp.mapper.IVaccinesMapper;
import com.zjp.mapper.I_SiteAndAreaMapper;
import com.zjp.mapper.InoculationSiteMapper;
import com.zjp.pojo.IVaccines;
import com.zjp.pojo.InoculationSite;
import com.zjp.service.InoculationSiteService;
import com.zjp.vo.I_SiteAndArea;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 接种点service的实现层
 */
@Service
public class InoculationSiteServiceImpl implements InoculationSiteService {

    @Autowired
    private InoculationSiteMapper siteMapper;
    @Autowired
    private IVaccinesMapper iVaccinesMapper;
    @Autowired
    private I_SiteAndAreaMapper i_SiteAndAreaMapper;


    // 查找所有接种点
    public List<I_SiteAndArea> findAllISite() {
        return i_SiteAndAreaMapper.findAllIsByAreaId();
    }

    // 添加接种点
    public int addInoculationSite(InoculationSite inoculationSite) {
        return siteMapper.insert(inoculationSite);
    }


    // 添加疫苗信息
    public int addIvaccine(IVaccines iVaccines) {
        return iVaccinesMapper.insert(iVaccines);
    }


    /**
     * 更新接种点信息
     * @param inoculationSite 接种点对象
     * @return 更新成功返回1，否则返回0
     */
    public int updateInoculationSite(InoculationSite inoculationSite) {
        return siteMapper.updateByPrimaryKey(inoculationSite);
    }


    public int deleteByInoculationid(Long inoculationid) {
        return siteMapper.deleteByPrimaryKey(inoculationid);
    }



}